//
//  EXT+UIImageView.swift
//  WB123
//
//  Created by xuyunde mac pro on 2017/6/29.
//  Copyright © 2017年 NSObjiect. All rights reserved.
//

import UIKit
import SDWebImage

extension UIImageView {
    // 快速实例化一个ImageView
    convenience init(named: String){
        self.init(image: UIImage(named: named))
    }
    
    // 对sd进行封装
    func wb_setImage(withUrlString: String?, placeholderImgName: String? = nil){
        
        if placeholderImgName == nil {
           self.sd_setImage(with: URL(string: withUrlString ?? ""), placeholderImage: UIImage(named: placeholderImgName ?? ""))
        }else{
            self.sd_setImage(with: URL(string: withUrlString ?? ""), placeholderImage: UIImage(named: placeholderImgName ?? ""))
        }
        
    }
}
